package com.example.demo.common.utils;

import java.io.FileWriter;
import java.io.IOException;

/* *
 *类名：AlipayConfig
 *功能：基础配置类
 *详细：设置帐户有关信息及返回路径
 *修改日期：2017-04-05
 *说明：
 *以下代码只是为了方便商户测试而提供的样例代码，商户可以根据自己网站的需要，按照技术文档编写,并非一定要使用该代码。
 *该代码仅供学习和研究支付宝接口使用，只是提供一个参考。
 */

public class AlipayConfig {

//↓↓↓↓↓↓↓↓↓↓请在这里配置您的基本信息↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓

    // 应用ID,您的APPID，收款账号既是您的APPID对应支付宝账号
    public static String app_id = "2016100200644138";

    // 商户私钥，您的PKCS8格式RSA2私钥
    public static String merchant_private_key = "MIIEvgIBADANBgkqhkiG9w0BAQEFAASCBKgwggSkAgEAAoIBAQDrokitWgAlCnC3UX1Zn8y53fm5ZBeOGlw2yHc9Y+U0xUVciGlcErzuLkkdtXX4refB8g1fNW3ycbGaDJ3oSf4IdBPy/QrrmPT5b6hL5aSGwua0sTHRpKnBkSoM2ToKOo2K2vdaCRp5ynRvQ0PM9wsE70/UhEB+18vrakPYVBbP/KRlWe+vz3JXMZYNkdo6GKDp5WC+Edgn9e/PyKOuewft/Rr1OoovHaFOVgE+PUo9ZSBdBogBspU4CxXNu+YPqCjnyj6UV0Scyzq/EtliJElvBURLuAW6iMgPZRn06egzCrn+yW6eIxfiQ7DNG/Nhcq8/c+L30cSKwwAelVoNEOc5AgMBAAECggEAF3xBSiXiRc7YlSzmFXy75vqc3UGAp4UxE7S/TbsbKTtQQnzGI4sqkYLDftaLP5H1u3rookitALEcRoJjareVPjpzkpBt+jVwlTvvxkDJOTVL0U6n7IFA+i4Bxu4Pvt0/JkvUw4CMxv7KxBwsMc2dp4xCpKfZ1cqkZH5e7LzU2T3gG/VUVpXQEuEm45wgXxNIqrCZClNKIoqKk0IAwn/CGRZ7YfaGMRlocnAZGMFmtmHDT42Osw77dF76Z3anGHrKUv8gPoR2YOX17Kzqa3vWU541XxRWKThhHhLJiZ+TL7uIUUVVCTsO0LNeuG3qkXyJpR2GEpzromhvcoxLYO+hkQKBgQD7Q8JlHxYrkK7baq29F5eW6Qfb7oIC6mHPDYy+31UyXuvVwlaA+7NVYxIqdxrDebbwDmC9W7KrqlJ/QBpdOLonhD6HIniwHHaTzYZEENPDInfgU1EWGh0fOxbRJU5gmFe93Ef+ckqy6UxLozza8Nkhk1BSjo0BpqNpovhg0jEcCwKBgQDwExzwJ0rO+oJYoJQBu112kLpBwcDiBg6E3LRyWY1vABLRzRMPVFoWx/ib9Pg4Y7h4DgaVyz6FP45PIPNENbMbp9bWa5IzGImvdmBA9iUHfwKc+6CT22wJxZLOhFDghKUv/jpVG2GQP+VjwrGsIzEuSyIHPCjEzHLqPHJB6+cQSwKBgQCzbpsW/ZEmgUbteAwkOgHOChHLtFJx5JD+fK2i7Pf5ZaHC3+pIZ/aUJpCldLLPH09NtObOsvov7wzExLFPGyCM8bp5ZFuNYHYpbJ7SYrXm5ul2b+k7AGEFmXvc1WhYQNJ/yhw7j8DabRJH/YWK0G4utPWqTxRRNoACAxieg9wAKwKBgEXcWfxsgrFuZoXh3JAQdOcuwHSoLDfZqVnyW7Q26RhW/iL9OUGpuzmL4YWIqL7IDgMpmbL3XO8rin7uSLwdoEw48CSfUwD5b/+WQ/ZDao0e4aTK+HRuUqcZTlo4WMys7ODlaxYfDKoMXfVEz60W5JXjGTjfwcFa+Um+Y0VZn3i3AoGBAI0XZiol43Ig1TYohDYOOAHIe3hxA5PhwCVuk3fNzXba4ixw8Jh/g/RK7OWzhj+wVPgq32P6VeVxyCQP44zgAt05RizsTwIlEvFTVoqGvd16SiBxVQ4JH6jdP/m+6Xc5XrvHuv9NugXqPeA4M/1O5TICnLt5VylY+wJrQJ0sb6Ue";
    // 支付宝公钥,查看地址：https://openhome.alipay.com/platform/keyManage.htm 对应APPID下的支付宝公钥。
    public static String alipay_public_key = "MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAgSRVJhYHslBOEEyImvfzmX+1zI10ErWYJ2yOh9ra4eHilPgaprhbIJkeDr0M5bKoE0v/csmx6worii3CVIwwQV+9qXSKMN6atA0DGJdq+GNy9fEOBfwC6Cx+2eSZj1qu7gqq5Gqd6EjuGFz5EF18eAsLLnYP+C1fAkDK++/4HwoJ5t0YFIyxhjsq1vzp4+bbXkVIkSidyrvt7xbz26hpdqcogtIUqOGM9BaLxQyYbnJhN3gD43N7HRh4LDpkVn+hRljNXub19gUgJ3BMtmJyTAIVUD4r7LcABJ+HP4hUneML1epIfoR0x1TBpfvHVu4aic9vr33CweHH+2lHhBuVkQIDAQAB";

    // 服务器异步通知页面路径  需http://格式的完整路径，不能加?id=123这类自定义参数，必须外网可以正常访问
    public static String notify_url = "http://工程公网访问地址/alipay.trade.page.pay-JAVA-UTF-8/notify_url.jsp";

    // 页面跳转同步通知页面路径 需http://格式的完整路径，不能加?id=123这类自定义参数，必须外网可以正常访问
    //public static String return_url = "http://127.0.0.1:8080/Return.jsp";
    public static String return_url = "http://192.168.101.13:8080/orderList";
    // 签名方式
    public static String sign_type = "RSA2";

    // 字符编码格式
    public static String charset = "utf-8";

    // 支付宝网关
    public static String gatewayUrl = "https://openapi.alipaydev.com/gateway.do";

    // 支付宝网关
    public static String log_path = "C:\\";


//↑↑↑↑↑↑↑↑↑↑请在这里配置您的基本信息↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑

    /**
     * 写日志，方便测试（看网站需求，也可以改成把记录存入数据库）
     *
     * @param sWord 要写入日志里的文本内容
     */
    public static void logResult(String sWord) {
        FileWriter writer = null;
        try {
            writer = new FileWriter(log_path + "alipay_log_" + System.currentTimeMillis() + ".txt");
            writer.write(sWord);
        } catch (Exception e) {
            e.printStackTrace();
        } finally {
            if (writer != null) {
                try {
                    writer.close();
                } catch (IOException e) {
                    e.printStackTrace();
                }
            }
        }
    }
}

